package d1130.r214.stringdemo;

import java.util.Scanner;

public class Demo05 {
    public static void main(String[] args) {
        System.out.println("请输入电话号码");
        Scanner sc=new Scanner(System.in);
        String phone=sc.next();
        if(checkPhoneNum(phone)){
            System.out.println("电话号码形式不正确");
        }else{
            System.out.println("电话号码形式不正确");
        }
    }

    public static boolean checkPhoneNum(String str){
        boolean ret=true;
        if(str.length()!=11){
            ret=false;
            
        }else{
            for(int i=0;i<str.length();i++){
                if(str.charAt(i)<0 ||str.charAt(i)>9){
                    ret=true;
                }
            }
        }
        return ret;
    }
}
